Ext.onReady(function() {
	Ext.QuickTips.init();
	
	var movie_form = new Ext.FormPanel({
		renderTo : document.body,
		frame : true,
		title : '信息填写',
		items: [{
			layout:'column',
            items: [{
            columnWidth:.5,
            layout: 'form',
            items: [{
				xtype : 'textfield',
				fieldLabel : '戶主姓名',
				name : 'repair.name',
				  anchor:'95%',
				allowBlank : false,
				regex : /^[\u4E00-\u9FA5]+$/,
				regexText : '只能输入汉字'
            }]
        },{
            columnWidth:.5,
            layout: 'form',
            items : [{
				xtype : 'textfield',
				fieldLabel : '家庭住址',
				name : 'repair.address',
				 anchor:'95%',
				allowBlank : false,
            }]
        }]
		},{
            	xtype : 'htmleditor',
        		fieldLabel : '故障信息',
        		name : 'repair.information',
        		 anchor:'95%',
        		height: 280, 
        		allowBlank : false,
        	    minLength:4,   
                minLengthText:'请尽量详细的描述'  
        	}],
		buttons:[{  
        text:'添加',
        type: 'submit',
        cls : "x-btn-text-icon",
        icon : "./images/icons/layout_add.png",
        handler:function(){  
        	if(movie_form.form.isValid()){  
        		  
                // ExtJs Ajax表单提交
        		movie_form.form.doAction('submit',{  
                    url:'Repair-add',  
                    method:'post',  

                    success:function(result,request){  
                    	window.location.href ='Repair-add.jsp'
                    },  

                    failure:function(){  
                        Ext.Msg.alert('警告', '未知的失败原因！');  
                    }  
                 });  
              }  
        }
		}]
	});
	
});